﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace smallDeimos.Game.Controls
{
    public partial class BuildBox : System.Web.UI.Page
    {
        int UserId;
        int sId, pId;
        string what;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["sd_id"] != null)
            {
                HttpCookie cookie2 = Request.Cookies["sd_id"];
                UserId = int.Parse(cookie2.Value);
            }
            else
            {
            }
            try
            {
                sId = int.Parse(Request.QueryString["SId"]);
                pId = int.Parse(Request.QueryString["PId"]);
            }
            catch (Exception)
            {
                return;
            }
            int planetOwner = UserDefinedFunctions.PlanetOwner(sId, pId).Value;
            if ((UserId != planetOwner) || (UserDefinedFunctions.FleetOwner(sId, pId) != 0 && UserDefinedFunctions.FleetOwner(sId, pId) != UserDefinedFunctions.PlanetOwner(sId, pId)))
            {
                return;
            }

            HiddenFieldWhat.Value = Request.QueryString["Build"];
            HiddenFieldPID.Value = Request.QueryString["PId"];
            HiddenFieldSID.Value = Request.QueryString["SId"];
            what = Request.QueryString["Build"];
        }
    }
}
